<!DOCTYPE html>
<?php
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
        <link rel="stylesheet" type="text/css" href="style.css"/>
    </head>
    <body>
        <?php
        include('functions.php');
        include('header.php');
        if (isset($_POST['pseudoinsc']) && isset($_POST['mailinsc']) && isset($_POST['passinsc'])) {
            // inscription voulue
            if(filter_var($_POST['mailinsc'], FILTER_VALIDATE_EMAIL) && strlen($_POST['pseudoinsc'])>= 3 && strlen($_POST['passinsc'])>= 3 ) {
                createUser($_POST['pseudoinsc'], $_POST['mailinsc'], md5($_POST['passinsc']));
            }else{
                echo 'L\'email doit être valide ainsi que le pseudo et le mot de passe qui doivent faire au moins 3 caractères';
            }
        }
        ?>
        <form class="formCo" method ="POST" action ="inscription.php">
            Pseudo<input type ="text" name="pseudoinsc" style="margin-left: 46px"/><br>
            Email<input type ="text" name="mailinsc" style="margin-left: 58px"/><br>
            Mot de Passe<input type ="password" name="passinsc" style="margin-left: 7px" />
            <input type="submit" value="S'inscrire"/>
        </form>
    </body>
</html>